What is filepond?
FilePond is a JavaScript library that allows you to upload files with a sleek, customizable interface. It supports multiple file uploads, image previews, drag-and-drop functionality, and integrates well with various frameworks like React, Vue, and Angular.
What are filepond's main functionalities?
Basic File Upload
This code snippet demonstrates how to create a basic file upload interface using FilePond. It initializes FilePond on an input element of type 'file'.
<script>
const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement);
</script>
Image Preview
This code snippet shows how to add image preview functionality to the file upload interface. It registers the Image Preview plugin and initializes FilePond on an input element.
<script>
FilePond.registerPlugin(FilePondPluginImagePreview);
const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement);
</script>
Drag and Drop
This code snippet demonstrates how to enable drag-and-drop functionality for file uploads. It initializes FilePond with options to allow dropping files on the page or on the file input element.
<script>
const pond = FilePond.create(
document.querySelector('input[type="file"]'),
{
dropOnPage: true,
dropOnElement: true
}
);
</script>
Server Integration
This code snippet shows how to integrate FilePond with a server endpoint for handling file uploads. It initializes FilePond with a server option pointing to the API endpoint.
<script>
const pond = FilePond.create(
document.querySelector('input[type="file"]'),
{
server: '/api'
}
);
</script>
Other packages similar to filepond
dropzone
Dropzone is a popular JavaScript library for drag-and-drop file uploads. It offers similar functionalities to FilePond, such as image previews and server integration. However, Dropzone is more focused on drag-and-drop interactions and may require more customization for other types of file uploads.
uppy
Uppy is a modular file uploader for web applications. It provides a wide range of plugins for different functionalities, including drag-and-drop, image previews, and server uploads. Uppy is highly customizable and can be integrated with various storage services like AWS S3 and Google Drive.
fine-uploader
Fine Uploader is a comprehensive file upload library that supports multiple file uploads, drag-and-drop, and server integration. It offers a variety of customization options and is known for its robustness and reliability. Fine Uploader is a good alternative to FilePond for more complex file upload requirements.
A JavaScript library that can upload anything you throw at it, optimizes images for faster uploads, and offers a great, accessible, silky smooth user experience.
21 KB gzipped. FilePond adapters are available for React, Vue, Angular and jQuery
FilePond is maintained by Rik Schennink
Core Features
- Accepts directories, files, blobs, local URLs, remote URLs and Data URIs.
- Drop files, select on filesystem, copy and paste files, or add files using the API.
- Async uploading with AJAX, or encode files as base64 data and send along form post.
- Accessible, tested with AT software like VoiceOver and JAWS, navigable by Keyboard.
- Image optimization, automatic image resizing, cropping, and fixes EXIF orientation.
- Responsive, automatically scales to available space, is functional on both mobile and desktop devices.
Learn more about FilePond
Browser Compatibility
FilePond is compatible with a wide range of desktop and mobile browsers, the oldest explicitely supported browser is IE11, for best cross browser support add FilePond Polyfill and Babel polyfill to your project.
FilePond uses BrowserStack for compatibility testing.
Time to learn ES6?
FilePond is written in ES6. The docs also feature a lot of ES6 code examples.
If you want to learn how to write modern ES6 JavaScript as well, ES6 for Everyone by Wes Bos is highly recommended.
Plugins
Adapters
Backend
Quick Start
Install using npm:
npm install filepond
Then import in your project:
import * as FilePond from 'filepond';
const pond = FilePond.create({
multiple: true,
name: 'filepond'
});
document.body.appendChild(pond.element);
Or get it from a CDN:
<!DOCTYPE html>
<html>
<head>
<title>FilePond from CDN</title>
<link href="https://unpkg.com/filepond/dist/filepond.css" rel="stylesheet">
</head>
<body>
<input type="file" class="filepond">
<script src="https://unpkg.com/filepond/dist/filepond.js"></script>
<script>
FilePond.parse(document.body);
</script>
</body>
</html>
Getting started with FilePond
Publications
License
Please don't remove or change the disclaimers in the source files
MIT License
Copyright (c) 2018 PQINA | Rik Schennink
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.